package vistas.ventanas;

import java.awt.Dimension;

import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JMenuBar;
import javax.swing.JPanel;
import javax.swing.JSeparator;
import javax.swing.JTabbedPane;

import vistas.paneles.Admin;
import vistas.paneles.Constancias;
import vistas.paneles.Consultas;
import vistas.paneles.Pagos;

public class MainWindow extends JFrame {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private JTabbedPane tabs;
	private JPanel container;
	private JMenuBar menubar;
	private Admin admin;
	private Constancias constancias;
	private Pagos pagos;
	private Consultas consultas;
	int x, y;

	public MainWindow() {
		x = getToolkit().getScreenSize().width;
		y = getToolkit().getScreenSize().height;
		setTitle("Shinken Dojo");
		setExtendedState(JFrame.MAXIMIZED_BOTH);
		setDefaultCloseOperation(EXIT_ON_CLOSE);
		setPreferredSize(new Dimension(x, y));
		setResizable(true);
		setLocationRelativeTo(null);

		tabs = new JTabbedPane();
		container = new JPanel();
		admin = new Admin();
		pagos = new Pagos();
		consultas = new Consultas();
		constancias = new Constancias();
		menubar = new JMenuBar();

		menubar.add(new JButton("Acerca de"));
		menubar.add(new JButton("Ayuda"));
		// menubar.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 12000));

		container.setLayout(new BoxLayout(container, BoxLayout.Y_AXIS));
		container.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10));

		tabs.setPreferredSize(new Dimension(x, (int) (y * 0.60)));
		tabs.addTab("Administración", admin);
		tabs.addTab("Pagos", pagos);
		tabs.addTab("Consultas", consultas);
	//	tabs.addTab("Perfiles", perfiles);
		tabs.addTab("Constancias", constancias);
		
		// container.add(menubar, Component.LEFT_ALIGNMENT);
		container.add(Box.createRigidArea(new Dimension(x, 5)));
		container.add(tabs);
		container.add(Box.createRigidArea(new Dimension(x, 10)));
		container.add(new JSeparator(JSeparator.HORIZONTAL));
		container.add(Box.createRigidArea(new Dimension(x, 10)));
		container.add(new JSeparator(JSeparator.HORIZONTAL));

		// pack();

		add(container);

	}
	
	public void setAdmin(Boolean cond){
		if(!cond){
			tabs.remove(admin);
		}
	}

}
